package cn.sccl.dirms.topo.discovery.model;

import org.apache.commons.lang3.StringUtils;

import java.sql.Timestamp;

/**
 * @author _minus
 * @create 2017-10-09 10:58
 *
 *
 */
public class DiscoverTaskVO {

    private String taskId; //这里是表 T_TOPO_DISCOVER_TASK id
    private String name ; //任务名称
    private String discoverRuleDetail;//发现规则的json字串
    private String graphyId;//topo图id
    private String userId;//定制改任务的用户id
    private String active;//是否启用;0 不启用，1启用
    private String targetObject;// 所调用的service
    private String targetMethod;//  所执行的方法

    private String groupName;//任务组


    private String taskScheduleId; //T_TOPO_DISCOVER_SCHEDULE id

    private String type;//任务类型

    private Long exeCnt ;//执行次数

    private String status ; //任务状态
    private Timestamp previousFireTime ; //最后一次执行时间
    private Timestamp nextFireTime ; //下次执行时间

    private String  minute ;
    private String  hour ;
    private String day;//天

    private Boolean isRepeat;//是否重复
    private String week;//周
    private String month;//每月

    private String mTimeInterval;//以分钟计算的间隔
    private String hTimeInterval;//以小时计算的间隔

    private Timestamp startTime;//任务开始时间
    private Timestamp endTime;//任务结束时间

    private  String cron ;//cron 表达式 这里有一定的规则生成


    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Timestamp getPreviousFireTime() {
        return previousFireTime;
    }

    public void setPreviousFireTime(Timestamp previousFireTime) {
        this.previousFireTime = previousFireTime;
    }

    public Timestamp getNextFireTime() {
        return nextFireTime;
    }

    public void setNextFireTime(Timestamp nextFireTime) {
        this.nextFireTime = nextFireTime;
    }

    public String getTaskId() {
        return taskId;
    }

    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDiscoverRuleDetail() {
        return discoverRuleDetail;
    }

    public void setDiscoverRuleDetail(String discoverRuleDetail) {
        this.discoverRuleDetail = discoverRuleDetail;
    }

    public String getGraphyId() {
        return graphyId;
    }

    public void setGraphyId(String graphyId) {
        this.graphyId = graphyId;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getActive() {
        return active;
    }

    public void setActive(String active) {
        this.active = active;
    }

    public String getGroupName() {
        if(StringUtils.isEmpty(this.groupName)){
            return this.type ;
        }
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public String getTaskScheduleId() {
        return taskScheduleId;
    }

    public void setTaskScheduleId(String taskScheduleId) {
        this.taskScheduleId = taskScheduleId;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Boolean getRepeat() {
        return isRepeat;
    }

    public void setRepeat(Boolean repeat) {
        isRepeat = repeat;
    }

    public Timestamp getStartTime() {
        return startTime;
    }

    public void setStartTime(Timestamp startTime) {
        this.startTime = startTime;
    }

    public Timestamp getEndTime() {
        return endTime;
    }

    public void setEndTime(Timestamp endTime) {
        this.endTime = endTime;
    }

    public String getCron() {
        if (StringUtils.isEmpty(this.cron)){
            //设置cron

        }
        return cron;
    }

    public String getTargetObject() {
        return targetObject;
    }

    public void setTargetObject(String targetObject) {
        this.targetObject = targetObject;
    }

    public String getTargetMethod() {
        return targetMethod;
    }

    public void setTargetMethod(String targetMethod) {
        this.targetMethod = targetMethod;
    }

    public Long getExeCnt() {
        return exeCnt;
    }

    public void setExeCnt(Long exeCnt) {
        this.exeCnt = exeCnt;
    }

    public String getMinute() {
        return minute;
    }

    public void setMinute(String minute) {
        this.minute = minute;
    }

    public String getHour() {
        return hour;
    }

    public void setHour(String hour) {
        this.hour = hour;
    }

    public String getDay() {
        return day;
    }

    public void setDay(String day) {
        this.day = day;
    }

    public String getWeek() {
        return week;
    }

    public void setWeek(String week) {
        this.week = week;
    }

    public String getMonth() {
        return month;
    }

    public void setMonth(String month) {
        this.month = month;
    }

    public String getmTimeInterval() {
        return mTimeInterval;
    }

    public void setmTimeInterval(String mTimeInterval) {
        this.mTimeInterval = mTimeInterval;
    }

    public String gethTimeInterval() {
        return hTimeInterval;
    }

    public void sethTimeInterval(String hTimeInterval) {
        this.hTimeInterval = hTimeInterval;
    }

    public void setCron(String cron) {
        this.cron = cron;
    }
}
